package com.dlut.txy.designpattern.schedule.builder;

import com.dlut.txy.designpattern.schedule.executor.ScheduleExecutor;
import com.dlut.txy.designpattern.schedule.executor.impl.DelayQueueScheduleExecutor;
import com.dlut.txy.designpattern.schedule.executor.impl.ThreadScheduleExecutor;
import com.dlut.txy.designpattern.schedule.task.ScheduleTask;
import com.dlut.txy.designpattern.schedule.task.ScheduleTaskParam;

public class ScheduleExecutorBuilder {
    public static ScheduleExecutor buildScheduleExecutor(ScheduleExecutor.Type type) {
        if(type == ScheduleExecutor.Type.THREAD) {
            return new ThreadScheduleExecutor();
        } else if(type == ScheduleExecutor.Type.DELAY_QUEUE) {
            return new DelayQueueScheduleExecutor();
        }
        throw new RuntimeException("不支持的定时器类型");
    }

}
